﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity;
using System.Globalization;
using System.Web.Security;

namespace RIS.TMP.WEB.APP.Models
{
    [Table("MRestoreToRepair")]
    public class MRestoreToRepair
    {
        [Key]
        [DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)]
        public int ReId { get; set; }
        [Display(Name = "รหัสสั่งซ่อม")]
        public string ReCode { get; set; }
        [Display(Name = "รหัสอ้างอิง")]
        public string RefCode { get; set; }
        [ForeignKey("MRestoreToAdmin")]
        public Nullable<int> ResId { get; set; }
        [ForeignKey("CCheckPlan")]
        public Nullable<int> ChpId { get; set; }

        [ForeignKey("COutsource")]
        public Nullable<int> OutId { get; set; }
        /// <summary>
        /// แผนซ่อมบำรุง
        /// </summary>
        public Nullable<int> PlanProject { get; set; }
        [DisplayFormat(DataFormatString = "{0:dd/MM/yyyy}", ApplyFormatInEditMode = true)]
        [DataType(DataType.Date)]
        [Display(Name = "วันที่ประมาณการรับรถ")]
        public Nullable<System.DateTime> SentTodate { get; set; }
        [DisplayFormat(DataFormatString = "{0:dd/MM/yyyy}", ApplyFormatInEditMode = true)]
        [DataType(DataType.Time)]
        [Display(Name = "เวลารับรถ")]
        public Nullable<System.DateTime> TimeSuc { get; set; }
        [ForeignKey("CStatusRepair")]
        public Nullable<int> StatusReId { get; set; }
        [Display(Name = "เลขที่ใบสั่งซื้อ")]
        public string BuyNo { get; set; }
        public Nullable<System.DateTime> StatusClose { get; set; }
        public string Remarks { get; set; }
        public string RecordStatus { get; set; }
        public string CreateBy { get; set; }
        public Nullable<System.DateTime> CreateWhen { get; set; }
        public string UpdateBy { get; set; }
        public Nullable<System.DateTime> UpdateWhen { get; set; }

        public virtual MRestoreToAdmin MRestoreToAdmin { get; set; }
        public virtual CCheckPlan CCheckPlan { get; set; }
        public virtual COutsource COutsource { get; set; }
        public virtual CStatusRepair CStatusRepair { get; set; }
    }
}